package com.company.manage.system.entity;

import com.company.manage.common.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.sql.Timestamp;
import static javax.persistence.GenerationType.IDENTITY;

/**
 * Created by HuangYong on 2016/1/22.
 * desc:
 */
@Entity
@Table(name = "t_log")
@DynamicUpdate
@DynamicInsert
public class Log extends BaseEntity {
    private static final String TAG = "Log";

    private static final long serialVersionUID = -5726712751631897007L;

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "ID",unique = true,nullable = false)
    private Integer id;

    @Column(name = "OPERATION_CODE",nullable = false,length = 50)
    private String operationCode;

    @Column(name = "CREATER",length = 24)
    private String creater;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+08:00")
    @Column(name = "CREATE_DATE",nullable = false,length = 24)
    private Timestamp createDate;

    @Column(name = "TYPE")
    private Integer type;

    @Column(name = "OS",length = 24)
    private String os;

    @Column(name = "BROWSER",length = 24)
    private String browser;

    @Column(name = "IP",length = 24)
    private String ip;

    @Column(name = "MAC",length = 24)
    private String mac;

    @Column(name = "EXECUTE_TIME")
    private Integer executeTime;

    @Column(name = "DESCRIPTION",length = 500)
    private String description;

    @Column(name = "REQUEST_PARAM",length = 500)
    private String requestParam;

    public Log() {
    }

    public Log(Integer id, String operationCode, String creater, Timestamp createDate, Integer type, String os, String browser, String ip, String mac, Integer executeTime, String description, String requestParam) {
        this.id = id;
        this.operationCode = operationCode;
        this.creater = creater;
        this.createDate = createDate;
        this.type = type;
        this.os = os;
        this.browser = browser;
        this.ip = ip;
        this.mac = mac;
        this.executeTime = executeTime;
        this.description = description;
        this.requestParam = requestParam;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOperationCode() {
        return operationCode;
    }

    public void setOperationCode(String operationCode) {
        this.operationCode = operationCode;
    }

    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getOs() {
        return os;
    }

    public void setOs(String os) {
        this.os = os;
    }

    public String getBrowser() {
        return browser;
    }

    public void setBrowser(String browser) {
        this.browser = browser;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public Integer getExecuteTime() {
        return executeTime;
    }

    public void setExecuteTime(Integer executeTime) {
        this.executeTime = executeTime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getRequestParam() {
        return requestParam;
    }

    public void setRequestParam(String requestParam) {
        this.requestParam = requestParam;
    }
}